self.addEventListener('message', async (e) => {
    const { taskId, data } = e.data;
    
    try {
      const result = await heavyCalculation(data);
      self.postMessage({ 
        taskId,
        result 
      });
    } catch (error) {
      self.postMessage({
        taskId,
        error: error.message
      });
    }
  });
  
  function heavyCalculation(data) {
    // 示例计算：字符翻转+哈希值
    return btoa(data.split('').reverse().join(''));
  }
  